package operator;
/*
    拓展的赋值运算符:
	    +=,-=,*=,/=,%=

    拓展的赋值运算符隐含了强制类型转换:
        short s = 10;
        s += 20;
        --> 展开式 : s = (short)(s + 20);
 */
public class OperatorDemo5 {
    public static void main(String[] args) {
        //定义一个变量
        int num = 10;
        System.out.println("num = " + num);//10

        num += 5;// num = (int)(num + 5);

        System.out.println("num = " + num);//15

        System.out.println("--------------------");

        byte b1 = 8;
        System.out.println("b1 = " + b1);//8

        b1 += 7;//b1 = (byte)(b1 + 7);
        //byte = int;
        //b1 = b1 + 7;

        System.out.println("b1 = " + b1);//15
        System.out.println("--------------------");

        short s1 = 7;
        short s2 = 8;

        //byte,short,char类型的变量在做运算的时候会自动提升至int类型再运算
        //short result1 = s1 + s2;//
        short result2 = 7 + 8;
    }
}
